#@layout()
<style>
	tr{
		height: 35px;
	}
	.leftTd {
		text-align: right;
		padding-right: 10px;
	}
	.rightTd{
		padding-left: 10px;
	}
	btn{
		width:100px;
		margin:0 auto;
		display:block;
	}
</style>
#define js()
<script>
    $(document).ready(function(){
        $("#submitBtn").click(function(){
            var mobile = $("#mobile").val();
            if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(mobile))){
                alert("请输入正确的手机号码格式");
                $("#mobile").focus();
                return false;
            }

            var templateCode = $("#templateCode").val();
            if(templateCode.length<=0){
                alert("请输入姓名");
                $("#templateCode").focus();
                return false;
            }

            var code="";
            var key1 = $("#key1").val();
            var val1 = $("#val1").val();
            var key2 = $("#key2").val();
            var val2 = $("#val2").val();
            var key3 = $("#key3").val();
            var val3 = $("#val3").val();
            var key4 = $("#key4").val();
            var val4 = $("#val4").val();
            var key5 = $("#key5").val();
            var val5 = $("#val5").val();
            if(key1.length>0 && val1.length>0) code = code +'\"'+ key1+"\""+":"+"\""+val1+"\""+",";
            if(key2.length>0 && val2.length>0) code = code +"\""+ key2+"\""+":"+"\""+val2+"\""+",";
            if(key3.length>0 && val3.length>0) code = code + key3+":"+val3+",";
            if(key4.length>0 && val4.length>0) code = code + key4+":"+val4+",";
            if(key5.length>0 && val5.length>0) code = code + key5+":"+val5+",";
			if (code.length>0){
			    var len = code.length;
                code = code.substr(0,len-1);
                code = "{" + code + "}";
			}

            $.ajax({
                url: "#(contextPath)/admin/notice/sendSMSNotice",
                type: 'POST',
                dataType: 'json',
                data:{
                    "phone":mobile,
                    "templateCode":templateCode,
					"code":code
                },
                success: function (data) {
                    alert(data.msg);

                }
            })

        })
    })
</script>
#end

#define main()
<table width="600px">
	<tr>
		<td class="leftTd">手机号：</td>
		<td class="rightTd">
			<input placeholder="请输入手机号" id="mobile" maxlength="15" />
		</td>
	</tr>
	<tr>
		<td class="leftTd">短信模板号：</td>
		<td class="rightTd">
			<input placeholder="请输入短信模板号" id="templateCode" />
		</td>
	</tr>
	<tr>
		<td class="leftTd">
			<span>key1：</span>
			<input id="key1"/>
		</td>
		<td class="rightTd">
			<span>value1：</span>
			<input id="val1" />
		</td>
	</tr>
	<tr>
		<td class="leftTd">
			<span>key2：</span>
			<input id="key2" />
		</td>
		<td class="rightTd">
			<span>value2：</span>
			<input id="val2" />
		</td>
	</tr>
	<tr>
		<td class="leftTd">
			<span>key3：</span>
			<input id="key3" />
		</td>
		<td class="rightTd">
			<span>value3：</span>
			<input id="val3" />
		</td>
	</tr>
	<tr>
		<td class="leftTd">
			<span>key4：</span>
			<input id="key4" />
		</td>
		<td class="rightTd">
			<span>value4：</span>
			<input id="val4" />
		</td>
	</tr>
	<tr>
		<td class="leftTd">
			<span>key5：</span>
			<input id="key5" />
		</td>
		<td class="rightTd">
			<span>value5：</span>
			<input id="val5" />
		</td>
	</tr>
	<!--<tr>-->
		<!--<td id="btnTd">-->
			<!---->
		<!--</td>-->
	<!--</tr>-->
</table>
<div align="center">
	<button type="button" id="submitBtn" style="width: 100px">提交</button>
</div>
#end